<template>
	<view class="page-total" :style="'top:calc(250rpx + '+pageTop+'rpx);' ">
		<!-- 服务 -->
		<!-- <view class="server-box">
			<view>
				<text class="iconfont">&#xe640;</text>
				<text>隶属上市体系</text>
			</view>
			<view>
				<text class="iconfont">&#xe641;</text>
				<text>100%正品保障</text>
			</view>
			<view>
				<text class="iconfont">&#xe642;</text>
				<text>品类齐全</text>
			</view>
			<view>
				<text class="iconfont">&#xe643;</text>
				<text>资质认证</text>
			</view>
			
		</view> -->
		<!--轮播 ，专区 -->
		<view class="banner">
			<swiper class="screen-swiper square-dot" indicator-dots="true" circular="true" autoplay="true"
				interval="5000" duration="500">
				<swiper-item v-for="(item,index) in bannerList" :key="index"
					@click.stop="toBannerUrl(item.miniProgramPath)">
					<image :src="item.src" mode="aspectFill"></image>
					<video :src="item.src" v-if="item.type=='video'" controls loop muted></video>
					<!-- <video src="{{item.url}}" autoplay loop muted show-play-btn="{{false}}" controls="{{false}}" objectFit="cover" wx:if="{{item.type=='video'}}"></video> -->
				</swiper-item>
			</swiper>
		</view>
		<!-- 分类列表 -->
		<view class="classify-list">
			<view class="ZsxlImg">
				<image class="image" :src="OSS_HOST+'img/home-clinic.png'"></image>
			</view>
			<view class="Dw">
				<!-- 				<view class="list" v-for="(item, index) in nav" @click="todetail(item)">
					<view class="thumb">
						<image :src="item.src"></image>
					</view>
					<view class="name"><text class="one-omit">{{item.name}}</text></view>
				</view> -->
				
		
				<swiper  class="Nsquare-dot" style="height: 380rpx;" indicator-active-color="#20B5FF"  indicator-dots="true" circular="true" >

					<swiper-item  style="display: flex;flex-wrap: wrap;height: 380rpx;"  v-for="(item, index) in nav" >
						<view class="list"  v-for="item1 in item" @click="todetail(item1)">
							<view class="thumb">
								<image :src="item1.src"></image>
							</view>
							<view class="name"><text class="one-omit">{{item1.name}}</text></view>
						</view>
					</swiper-item>
				</swiper>


			</view>

		</view>

		<!-- 砍价活动 -->
		<!-- <view  class="activity-bargin">
			<view class="title-img" @tap="toActivity">
				<img :src="OSS_HOST+'img/bargain-icon1.png'" mode="aspectFit" alt="">
			</view>
			<view class="product-list product-bg" >
				<view class="product-box" v-for="(item, index) in bargain" v-if="index<=3" @tap="toActivity">
					<view class="product-img"> 
						<img :src="item.cover_image" mode="aspectFit" alt="">
					</view>
					<view class="product-price" >
						<view class="price" >
							<span class='price-nav'>去砍价</span>
							<text class="price-txt">{{item.price}}</text>
						</view>
						<view  class="font-icon">
							<img :src="OSS_HOST+'img/home-bargain-icon.png'"  alt="">
						</view>
					</view>
					
				</view>
			</view>
		</view> -->
		<!-- 每日特价 -->
		<!-- <view  class="activity-bargin">
			<view class="title-img" @tap="toTejia">
				<img :src="OSS_HOST+'img/home-activity-tejia1.png'"   mode="widthFix" alt="">
			</view>
			<view class="product-list" >
				<view class="product-box" v-for="(item, index) in hotList" v-if="index<=3"  @click="onSkip('goods',item.id)">
					<view class="product-img"> 
						<img :src="item.cover_image" @error='imgerr'  mode="aspectFit" alt="">
					</view>
					<view class="product-price-temp">
						<view class="price">
							<span class='price-nav'>去砍价</span>
							<text class="price-txt">￥{{item.price}}</text>
						</view>
						<view class="cost">
							<text class="cost-price-txt">￥{{item.cost}}</text>
						</view>
						<view  class="font-icon">
							<img :src="OSS_HOST+'img/home-bargain-icon.png'"  alt="">
						</view>
					</view>
					
				</view>
			</view>
		</view> -->
		<!--专区 列表 暂时限制6个专区-->
		<!-- 		<ivew class="zhuanqu-list">
			
			<view class="tempList-item"  v-for="row,index in tempList"  @tap="tozhuanqu(row)" v-if="index<=5" >
				<img :src="row.cover_image" alt="" mode="">
			</view>
		</ivew> -->

		<!-- 每日特价 -->
		<!-- <view class="super-hot-style">
		
			<view class="hot-title">
				<view class="iconfont ">&#xe604;</view>
		
				<view class="title"><image :src="OSS_HOST+'img/day-tejia.png'" mode="aspectFit" ></image></view>
				<view class = "most" @tap="toMost('每日特价')">更多	<text class="iconfont " style="color: #808080;">&#xe626;</text></view>
			</view>
			<view class="goods-list">
				<view class="list" v-for="(item, index) in hotProduct" @click="onSkip('goods',item.id)" :key="index">
					<view class="thumb">
						<image :src="item.cover_image" mode="widthFix"></image>
					</view>
					<view class="title"><text class="one-omit">{{item.name}}</text></view>
					<view class="price">
						<view class="retail-price">
							<text class="min">￥</text>
							<text class="max">{{item.price}}</text>
						</view>
						<view class="sales-volume">已售{{item.sale_count}}件</view>
					</view>
				</view>
			</view>
		</view> -->
		<!-- 专区 -->
		<!-- <view class="zhuanqu">
			<view class="zhuanqu-box"  v-for="row in tempList" >
				<view class="title">
					
					<image :src="row.cover_image" mode="heightFix" ></image>
					<view class = "most" @tap="tozhuanqu(row)">更多	<text class="iconfont " style="color: #808080;">&#xe626;</text></view>
					
					
				</view>
				<view class="goods-list">
					<view class="list" v-for="(item, index) in row.sub"   @click="onSkip('goods',item.id)">
						<view class="thumb">
							<image :src="item.cover_image" mode="heightFix"></image>
						</view>
						<view class="title"><text class="one-omit">{{item.name}}</text></view>
						<view class="price">
							<view class="retail-price">
								<text class="min">￥</text>
								<text class="max">{{item.price}}</text>
							</view>
							<view class="sales-volume">已售{{item.sale_count}}件</view>
						</view>
					</view>
				</view>
				
			</view>
			
		</view> -->
		<!-- 欧械租赁 -->
		<!-- <view class="activity-zl">
			<view class="image"  @tap="tozhulin">
				<image :src="OSS_HOST+'img/zulin-img.png'" mode="aspectFit" ></image>
			</view>
		</view> -->



		<!-- 超值爆款 -->
		<!-- 		<view class="super-hot-style">

			<view class="hot-title">
				<view class="iconfont icon-zhizi"></view>

				<view class="title">超值爆款</view>
			</view>
			<view class="goods-list">
				<view class="list" v-for="(item, index) in hotList" @click="onSkip('goods',item.id)" :key="index">
					<view class="thumb">
						<image :src="item.cover_image" mode="widthFix"></image>
					</view>
					<view class="title"><text class="one-omit">{{item.name}}</text></view>
					<view class="price">
						<view class="retail-price">
							<text class="min">￥</text>
							<text class="max">{{item.price}}</text>
						</view>
						<view class="sales-volume">已售4件</view>
					</view>
				</view>
			</view>
		</view> -->
		<!-- 特价专场 -->
		<view class="super-hot-style">

			<view class="XZsxlImg">
				<image class="image" :src="OSS_HOST+'img/home-tejia.png'"></image>
			</view>
			<view class="goods-list">

				<view class="Tj">
					<view class="list" v-for="(item, index) in Xnav" @click="todetail(item)">
						<view class="thumb">
							<image :src="item.src"></image>
						</view>
						<!-- <view class="name"><text class="one-omit">{{item.name}}</text></view> -->
					</view>
				</view>
			</view>
		</view>


		<!-- 更多热卖 -->
		<view class="more-hot">
			<!-- <view class="hot-title">
				<view class="title">
					<img :src="OSS_HOST+'img/jingxuan.png'" style="width: 686rpx;height: 80rpx;" alt="">
					<text class="iconfont "></text>
					<text class="icon">更多热卖</text>
					<text class="iconfont "></text>
				</view>
			</view> -->
			<view class="goods-list">
				<view class="list" v-for="(item,index) in productList" @click="onSkip('goods',item.id)" :key="index">
					<view class="pictrue">
						<image :src="item.cover_image" mode="heightFix"></image>
					</view>
					<view class="title-tag">
						<view class="tag" style=" font-size: 28rpx;">
							<text style="color:#333333;" v-if="item.is_goods === 1">特价</text>
							{{item.name}}
						</view>
					</view>
					<view class="price-info">

						<view class="user-price"
							style="display: flex;align-items: center;justify-content: space-between;width: 100%;">
							<view class="">
								<text style="color:#FF5733;font-size: 32rpx;font-weight: bold;" class="min">￥</text>
								<text style="color:#FF5733;font-size: 32rpx;font-weight: bold;"
									class="max">{{item.price}}</text>
							</view>
							<!-- <text style="color:#999999;font-size: 10px;padding-left:2px;text-decoration:line-through;">￥{{item.cost}}</text> -->
							<view class="">
								<text style="color:#999999;font-size: 20rpx;">已售{{item.sale_count}}件</text>
							</view>
						</view>

					</view>
				</view>
			</view>
		</view>

		<uni-popup-vlogin id="popupvLogin" ref="popupvLogin" type="bottom" />
	</view>
</template>

<script>
	import uniPopup from '@/components/uni-popup/uni-popup.vue'
	import {
		oss_host
	} from '@/config/config.js';
	import pages from '@/static/js/pages.js';
	export default {
		props: {
			title: {
				type: String,
				default: ''
			},
			hotList: {
				type: Array,
				default: []
			},
			propertyList: {
				type: Array,
				default: []
			},
			productList: {
				type: Array,
				default: [],
				// {cover_image:11,is_goods:22,name:33,price:44,cost:55,sale_count:66}
			},
			
			// 专区
			tempList: {
				type: Array,
				default: []
			},
			// 专区
			nav: {
				type: Array,
				default: []
			},
			// 轮播
			bannerList: {
				type: Array,
				default: []
			},
			// 特价
			hotProduct: {
				type: Array,
				default: []
			},
			// 砍价
			bargain: {
				type: Array,
				default: []
			},
			loginStatus: {
				type: Boolean,
				default: false
			},
			pageTop:{
				type: String,
				default: '40'
			}

		},
		components: {

			uniPopup,

		},
		computed: {

			// 一个计算属性的 getter

			productList1() {
				//    // `this` 指向当前组件实例
				// console.log(this.productList)
				// // this.productList = [{cover_image:99999,is_goods:22,name:99999,price:44,cost:55,sale_count:66}]
				//      return this.productList
			}
		},

		data() {
			return {
				OSS_HOST: oss_host,
				Xnav: [{
					create_time: "2024-06-19",
					estate: 1,
					id: 5,
					is_del: 0,
					name: "注输专场",
					sorter: 4,
					src: "https://cgapi.opportshop.com/static/img/home-shuzhu.png",
					update_time: "2024-07-21",
					url: "/pages/ActivityRet/index?title=注输专场&id=17"
				}, {
					create_time: "2024-06-19",
					estate: 1,
					id: 3,
					is_del: 0,
					name: "耗材专场",
					sorter: 1,
					src: "https://cgapi.opportshop.com/static/img/home-haocai.png",
					update_time: "2024-07-21",
					url: "/pages/ActivityRet/index?title=耗材专场&id=15"
				}, {
					create_time: "2024-06-19",
					estate: 1,
					id: 6,
					is_del: 0,
					name: "消毒专场",
					sorter: 4,
					src: "https://cgapi.opportshop.com/static/img/home-xiaodu.png",
					update_time: "2024-07-21",
					url: "/pages/ActivityRet/index?title=消毒专场&id=16"
				}, ]
				// hotList:[],
				// bannerList:[],
				// tempList:[],
				// goodsList:[],
				// 	{
				// 		id: 1,
				// 		name: 'BANDALY 2020夏季女装连衣裙韩版大码宽松显瘦套装裙子两件套 JX19301 上豆绿下米白 M ',
				// 		price: '219.00',
				// 		vip_price: '129.00',
				// 		img: '/static/img/goods_thumb_01.png',
				// 		is_goods: 0,
				// 	}
				// ],
				// classGoodsList: [],
				// 	{
				// 		id: 1,
				// 		name: '荣耀Play4T 全网通6GB+128GB大内存 幻夜黑 4000mAh大电池 4800万AI摄影  6.39英寸魅眼屏',
				// 		price: '1190.00',
				// 		vip_price: '1100.00',
				// 		img: '/static/img/goods_thumb_11.png',
				// 		is_goods: 0,
				// 	}
				// ]

			};
		},
		onLoad: function(e) {
			console.log(9999)
		},
		methods: {
			imgerr(e) {
				console.log(e, '****imgerrr*****')
				e.target.src = 'http://img.opportshop.com/uploader/upload/202407/14/202407142130576693d31185790.png'
			},
			toBannerUrl(item) {
				let _this = this
				if (item == '') {
					return;
				}
				let require_url = item.split('?');

				// console.log(require_url,'******')
				// console.log(pages.hasOwnProperty(require_url[0]),'*******')
				if (!pages.hasOwnProperty(require_url[0])) {
					// console.log(11111111)
					console.log(_this.loginStatus, '*******')
					if (!_this.loginStatus) {
						_this.$refs.popupvLogin.open()
						return true;
					}



				}

				uni.navigateTo({
					url: item
				})
			},
			toMost(title) {
				uni.navigateTo({
					url: '/pages/Activity/index?title=' + title

				})
			},
			todetail(item) {
				let _this = this
				if (item.url == '/pages/classify/classify') {
					wx.switchTab({
						url: '/pages/classify/classify',
						success: (res) => {
							let page = getCurrentPages().pop();
							if (page == undefined || page == null) return;
							page.curSegment = 0;
							page.onLoad();
						},
					})
				} else {
					uni.navigateTo({
						url: item.url

					})
				}

			},
			tozhuanqu(row) {
				let _this = this
				_this.$refer.setVilit('/pages/ActivityRet/index')
				let callback = function(url) {
					_this.$refs.popupvLogin.open()
				}
				let data = {
					title: row.name,
					id: row.id
				}
				_this.$refer.toUrl(callback, data)
				// uni.navigateTo({
				// 	url: '/pages/ActivityXuetan/index?title='+title

				// })
			},
			toTejia() {
				let _this = this
				_this.$refer.setVilit('/pages/Activity/index')
				let callback = function(url) {
					_this.$refs.popupvLogin.open()
				}
				let data = {

				}
				_this.$refer.toUrl(callback, data)

			},
			tozhulin() {
				uni.navigateTo({
					url: '/packagePlugin/pages/index'
				})
			},
			// 砍价列表
			toActivity() {
				let _this = this

				_this.$refer.setVilit('/pages/Bargain/index')
				let callback = function(url) {
					_this.$refs.popupvLogin.open()
				}
				let data = {
					// property_id:id,

				}
				_this.$refer.toUrl(callback, data)
				// uni.navigateTo({
				// 	url: '/pages/Bargain/index'
				// })
			},
			/**
			 * 跳转点击
			 * @param {String} type 跳转类型
			 */
			onSkip(type, id = 0) {
				let _this = this
				switch (type) {
					case 'classify':
						// 跳转					
						_this.$refer.setVilit('/pages/SearchGoodsList/SearchGoodsList')
						let callback = function(url) {
							_this.$refs.popupvLogin.open()
						}
						let data = {
							property_id: id,

						}
						_this.$refer.toUrl(callback, data)
						break;
					case 'goods':

						_this.$refer.setVilit('/pages/GoodsDetails/GoodsDetails')
						let callback1 = function(url) {
							_this.$refs.popupvLogin.open()
						}
						let data1 = {
							id: id,

						}
						_this.$refer.toUrl(callback1, data1)
						break;
				}
			}
		}
	};
</script>

<style lang="scss">
	@import 'ClassifyData.scss';

</style>